//
//  RuleCoverView.m
//  tour
//
//  Created by 卡忙科技 on 16/7/27.
//  Copyright © 2016年 Jushi. All rights reserved.
//

#import "RuleCoverView.h"
#import "UIView+Extension.h"

@interface RuleCoverView()

@property (nonatomic,weak) UILabel *ruleLab;

@end
@implementation RuleCoverView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = RGBACOLOR(0, 0, 0, 0.2);
        
        UIView *bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenW, 100)];
        bgView.backgroundColor = [UIColor whiteColor];
        [self addSubview:bgView];
        UILabel *ruleLab = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, ScreenW-20, 90)];
        ruleLab.font = Font(16);
        ruleLab.numberOfLines = 0;
        ruleLab.textColor = [UIColor grayColor];
        ruleLab.backgroundColor = [UIColor whiteColor];
        self.ruleLab = ruleLab;
        [bgView addSubview:ruleLab];
    }
    return self;
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self removeFromSuperview];
}

- (void)setText:(NSString *)text
{
    _text = text;
    self.ruleLab.text = text;
    [self.ruleLab sizeToFit];
    self.ruleLab.superview.height = self.ruleLab.height+10;
}

@end
